<template>
   <div class="produce-in-table-wrap">
    <el-table
      :data="tableData"
      style="width: 100%"
      :border="true"
      :fit="true"
      :stripe="true"
      size="mini"
      align="center">
      <el-table-column
        prop="id"
        label="id"
        min-width="100"
        align="center">
      </el-table-column>

      <el-table-column
      :show-overflow-tooltip="true"
        prop="order"
        label="采购退货单"
        min-width="130"
        align="center">
      </el-table-column>

      <el-table-column
        prop="all_price"
        label="退货金额"
        min-width="120"
        align="center">
      </el-table-column>

      <el-table-column
        prop="make_username"
        label="制单人"
        min-width="120"
        align="center">
      </el-table-column>

      <el-table-column
        prop="do_name"
        label="经办人"
        min-width="120"
        align="center">
      </el-table-column>

      <el-table-column
      :show-overflow-tooltip="true"
        prop="date"
        label="时间"
        min-width="90"
        align="center">
      </el-table-column>

      <el-table-column
        prop="status"
        label="状态"
        min-width="120"
        align="center">
      </el-table-column>

      <el-table-column label="操作"
      min-width="210"
      align="center">
        <template slot-scope="scope">

          <template>
            <el-button
              size="mini"
              plain
              type="primary"
              @click="ckeck(scope.row)">查看</el-button>
          </template>

        </template>
      </el-table-column>
    </el-table>
    <deleteConfirm v-if="showMask" @closeDelete="closeDelete" @deleteConfirm="deleteConfirm"></deleteConfirm>
  </div>
</template>
<script lang="ts">
import Vue from 'vue';
import Component from 'vue-class-component';
import { Prop, Emit } from 'vue-property-decorator';
import ajaxResquest from '@/api/apiRequest';
import deleteConfirm from '@/components/deleteConfirm.vue';

@Component({
  components: {
    deleteConfirm
  }
})
export default class ProduceInTable extends Vue {
  @Prop({
    type: Array
  })
  tableData!: any[];
  showMask: boolean = false;
  deleteRes!: ajaxResquest;
  deleteId!: number;
  mounted() {
    this.deleteRes = new ajaxResquest('/order/delOrder');
  }
  ckeck(row: any) {
    console.log(row);
    this.$to('supplierReturnCheck', { id: row.id, status: row.status });
  }
  del(row: any) {
    this.deleteId = row.id;
    this.showMask = true;
  }
  closeDelete() {
    this.showMask = false;
  }
  deleteConfirm() {
    this.deleteRes
      .getFunction({ orderInfoId: this.deleteId })
      .then((res: any) => {
        if (res.data.code === 1) {
          this.showMask = false;
        }
        this.getData();
      });
  }

  @Emit('getData')
  getData() {}
}
</script>
<style lang="less">
.produce-in-table-wrap {
}
</style>
